﻿@model SmsTemplates

@using (Html.BeginAjaxForm("_EditManageSms", "ControlPanelSettings", null, FormMethod.Post, new AjaxFormOptions().SetCloseDialog(false).SetOnSuccessCallBack("EditOutBoxOnSuccessCallBack"), new { id = "form_EditOutBox" }))
{
    @Html.HiddenFor(n => n.id)
    <div class="tnc-dailog-pd">
        @Html.StatusMessage()
        <div class="tn-form tn-label-right tnc-label-short tnc-tips-location">
            <div class="tn-form-row">
                <label class="tn-form-label" for="UserEmailAddress">
                    模板名称：
                </label>
                @Html.TextBoxFor(n => n.TemplateName, InputWidthTypes.Medium)
                @Html.ValidationMessageFor(n => n.TemplateName)
            </div>
            <div class="tn-form-row">
                <label class="tn-form-label" for="Password">
                    模板内容：
                </label>
                @Html.TextBoxFor(n => n.TemplateValue, InputWidthTypes.Medium)
                @Html.ValidationMessageFor(n => n.TemplateValue)
            </div>

                <div class="tn-form-row">
                    <label class="tn-form-label" for="UserName">
                        平台名称ID：
                    </label>
                    @Html.TextBoxFor(n => n.SmsSettingsId, InputWidthTypes.Medium)
                    @Html.ValidationMessageFor(n => n.SmsSettingsId)
                </div>
        </div>
    </div>
    <div class="tnc-artdilog-btn tn-border-gray tn-border-top tn-bg-gray">
        @Html.Button("确定", ButtonTypes.Submit, HighlightStyles.Primary)
        @Html.Button("取消", ButtonTypes.Submit, HighlightStyles.Secondary, htmlAttributes: new { dialogoperation = "close", id = "CloseArtdilogButton" })
    </div>

}
<script type="text/dialog">
    this.title("@(Model.id > 0 ? "编辑短信模板" : "添加短信模板")");
</script>
<script language="javascript" type="text/javascript">
    function EditOutBoxOnSuccessCallBack(data) {
        if (data.MessageContent) {
            if (data.MessageType <= 0) {
                art.dialog.tips(data.MessageContent, 1.5, data.MessageType);
            } else {
                var list = art.dialog.list;
                for (var i in list) {
                    list[i].close();
                };
                art.dialog.tips(data.MessageContent, 1.5, data.MessageType, function () { window.location.reload(true); });
            }
        } else {
            $("#form_EditOutBox").replaceWith(data);
        }
    }
</script>
